﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ParentChildLookup.Data
{
    public static class SPData
    {
        public const string OPERATION_PREFIX = "CustomAction_{0}";

        public static class Lists
        {
            public static class Configuration
            {
                public const string URL = "Lists/ParentChildConfiguration";

                public static class CAMLQueries
                {
                    public static string GetConfigurationByListURL = string.Format("<Where><Eq><FieldRef Name='{0}'/><Value Type='Text'>{1}</Value></Eq></Where>", SPData.ContentTypes.Configuration.Fields.LIST_URL, "{0}");
                }
            }

            public static class CommonCamlQueries
            {
                public const string GetNoItems = "<Query><Where><IsNull><FieldRef Name='ID' /></IsNull></Where></Query>";
                public const string GetItemByLookup = "<Where><Eq><FieldRef Name='{0}' LookupId='TRUE'/><Value Type='Lookup'>{1}</Value></Eq></Where>";
            }
        }

        public static class ContentTypes
        {
            public const string GROUP = "Parent Child Lookup Content types";

            public static class Configuration
            {
                public const string ID = "0x0100F753E5AEB9DA404cB872B88F6A9C9263";

                public static class Fields
                {
                    public const string TITLE = "Title";
                    public const string LIST_URL = "ParentChildListUrl";
                    public const string FORMULA = "ParentChildFormula";
                    public const string REFRESH_LIST = "ParentChildRefreshList";
                }
            }
        }


        public static class Enumerations
        {
            public enum SPOperations
            {
                IncrementMinorVersion = 1,
                IncrementMajorVersion,
                ChangeEnvToRec,
                ChangeEnvToPrd,
                ChangeEnvToPprd
            }

            public enum Environnements
            {
                Preprod = 1,
                Prod,
                Rec,
                Dev
            }

            public enum ObjectType
            {
                List,
                ContentType
            }
        }
    }
}
